package com.example.finalassignment.mapper;

import com.example.finalassignment.pojo.Stars;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

/**
* @author guocheng
* @description 针对表【stars】的数据库操作Mapper
* @createDate 2024-06-08 14:16:07
* @Entity com.example.finalassignment.pojo.Stars
*/
public interface StarsMapper {

    int deleteByPrimaryKey(Long id);

    int insert(Stars record);

    int insertSelective(Stars record);

    Stars selectByPrimaryKey(@Param("uuid")String uuid);

    int updateByPrimaryKeySelective(Stars record);

    int updateByPrimaryKey(Stars record);

    /**
     * 取消点赞
     * @param uuid
     * @return
     */
    @Delete("delete from stars where uuid = #{uuid} and user_id = #{userId}")
    int closeByUuidAndUserId(@Param("uuid")String uuid,@Param("userId") String userId);

    @Select("select * from stars where uuid = #{uuid} and user_id = #{userId}")
    Stars getStarsByUserId(@Param("uuid") String uuid,@Param("userId") String userId);
}
